<template>
    <view>
        <!-- #ifdef MP-WEIXIN -->
        <view v-if="isMnpWxAuth">
            <button class="login-btn white" @tap="$emit('mnLogin')" size="lg">用户一键登录</button>
        </view>
        <!-- #endif -->
        <!-- #ifdef H5 -->

        <view v-if="isOaWxAuth && isWeixin">
            <button class="login-btn white" @tap="$emit('getCodeUrl')" size="lg">用户一键登录</button>
        </view>
        <!-- #endif -->
        <!-- #ifdef APP-PLUS -->
        <view v-if="isAPPWxAuth">
            <button class="login-btn white" @tap="$emit('appLogin')" size="lg">用户一键登录</button>
        </view>
        <!-- #endif -->
        <!-- #ifdef MP-TOUTIAO -->
        <view v-if="isToutiaoAuth">

            <button class="login-btn white" @tap="$emit('ttLogin')" size="lg">用户一键登录</button>
        </view>
        <!-- #endif  -->
        <button class="chang-btn" @tap="$emit('changeLoginWay')" size="lg">
            手机号码登录
        </button>
    </view>
</template>

<script>
import { isWeixinClient } from "@/utils/tools";
export default {
    name: 'defaultLogin',
    props: {
        isWeixin: {
            type: Boolean,
            default: false
        }
    },
    data() {
        return {
            // isWeixin: true
        }
    },
    methods: {

    },
    computed: {
        // 开启小程序微信授权
        isMnpWxAuth() {
            const { mnp_wechat_auth } = this.appConfig;
            return mnp_wechat_auth;
        },

        // 开启小程序微信授权
        isOaWxAuth() {
            const { h5_wechat_auth } = this.appConfig;
            return h5_wechat_auth;
        },
        // 开启app微信授权
        isAPPWxAuth() {
            const { app_wechat_auth } = this.appConfig;
            return app_wechat_auth;
        },
        // 开启公众号微信自动登录
        isOaWxAutoLogin() {
            const { h5_auto_wechat_auth } = this.appConfig;
            return h5_auto_wechat_auth;
        },
        // 开启小程序头条登录
        isToutiaoAuth() {
            const { toutiao_auth } = this.appConfig;
            return toutiao_auth;
        },
    }
}
</script>

<style lang="scss" scoped>
.chang-btn {
    height: 100rpx;
    line-height: 100rpx;
    margin-top: 30rpx;
    background-color: white;
    color: #666666;
    border: 1px solid #BBBBBB;
}

.login-btn {
    height: 100rpx;
    line-height: 100rpx;
    margin: 130rpx 0 50rpx;
    @include background_color();
}
</style>
